home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / util / cli / ksc_Reset.lha / Reset.asm next >
Encoding:
Assembly Source File  |  1998-04-27  |  2.1 KB  |  110 lines

  1. ; Reset v1.2 : Reset the Amiga
  2. ; by Kyzer/CSG
  3. ; $VER: Reset.asm 1.3 (08.04.98)
  4. ;
  5.     incdir    include:
  6.     include    lvo/dos_lib.i
  7.     include    lvo/exec_lib.i
  8.     include    lvo/graphics_lib.i
  9.     include    lvo/intuition_lib.i
  10.     include    exec/libraries.i
  11.     include    dos/dosextens.i
  12.  
  13. Reset    move.l    4.w,a6
  14.     sub.l    a1,a1
  15.     jsr    _LVOFindTask(a6)
  16.     move.l    d0,a4
  17.     moveq    #0,d0
  18.     tst.l    pr_CLI(a4)
  19.     bne.s    .nomsg
  20.     lea    pr_MsgPort(a4),a0
  21.     jsr    _LVOWaitPort(a6)
  22.     lea    pr_MsgPort(a4),a0
  23.     jsr    _LVOGetMsg(a6)
  24. .nomsg    tst.l    d0
  25.     beq.s    .reset
  26.     move.l    d0,-(sp)
  27.  
  28.     lea    intname(pc),a1
  29.     moveq    #36,d0
  30.     jsr    _LVOOpenLibrary(a6)
  31.     tst.l    d0
  32.     beq.s    .noint
  33.     move.l    d0,a6
  34.     suba.l    a0,a0
  35.     move.l    a2,a3
  36.     suba.l    a2,a2
  37.     pea    resp(pc)
  38.     pea    body(pc)
  39.     pea    title(pc)
  40.     pea    0.w
  41.     pea    20.w
  42.     move.l    sp,a1
  43.     jsr    _LVOEasyRequestArgs(a6)
  44.     adda.w    #20,sp
  45.     tst.l    d0
  46.     bne.s    .reset
  47.  
  48.     move.l    a6,a1
  49.     move.l    4.w,a6
  50.     jsr    _LVOCloseLibrary(a6)
  51. .noint
  52.     move.l    (sp)+,d0
  53.     beq.s    .exit
  54.     move.l    d0,a2
  55.     jsr    _LVOForbid(a6)
  56.     move.l    a2,a1
  57.     jsr    _LVOReplyMsg(a6)
  58.     jsr    _LVOPermit(a6)
  59. .exit    moveq    #0,d0
  60.     rts
  61.  
  62. .reset    move.l    4.w,a6
  63.     lea    dosname(pc),a1
  64.     moveq    #32,d0
  65.     jsr    _LVOOpenLibrary(a6)
  66.     tst.l    d0
  67.     beq.s    .die
  68.     move.l    d0,a6
  69.     moveq    #30,d1
  70.     jsr    _LVODelay(a6)
  71.     move.l    a6,a1
  72.     move.l    4.w,a6
  73.     jsr    _LVOCloseLibrary(a6)
  74. .die    lea    gfxname(pc),a1
  75.     moveq    #32,d0
  76.     jsr    _LVOOpenLibrary(a6)
  77.     tst.l    d0
  78.     beq.s    .kill
  79.     move.l    d0,a6
  80.     suba.l    a1,a1
  81.     jsr    _LVOLoadView(a6)
  82.     jsr    _LVOWaitTOF(a6)
  83.     jsr    _LVOWaitTOF(a6)
  84.     move.l    a6,a1
  85.     move.l    4.w,a6
  86.     jsr    _LVOCloseLibrary(a6)
  87. .kill    move.w    #$000,$dff180    ; custom.color00 == black
  88.     cmp.w    #36,LIB_VERSION(a6)
  89.     bcc.s    .wb13
  90.     jmp    _LVOColdReboot(a6)
  91.     ; pre-v36 reset routine
  92. .wb13    lea    $1000000,a0    ; end of ROM
  93.     sub.l    -$14(a0),a0    ; (end of ROM)-(ROM size)=ROM start
  94.     move.l    4(a0),a0    ; Get initial PC
  95.     subq.l    #2,a0        ; now points to second RESET
  96.     lea    .sup(pc),a5
  97.     jmp    _LVOSupervisor(a6)
  98.     cnop    0,4
  99. .sup    reset            ;\_ these two instructions must
  100.     jmp    (a0)        ;/  share a longword.
  101.  
  102.  
  103. intname    dc.b    "intuition.library",0
  104. dosname    dc.b    "dos.library",0
  105. gfxname    dc.b    "graphics.library",0
  106. title    dc.b    "Reset",0
  107. body    dc.b    "This will reset your Amiga!!!",10
  108.     dc.b    "Are you sure you want to go ahead?",0
  109. resp    dc.b    "Reset|Cancel",0
  110.